package com.missilike.admin.controller;


import com.missilike.biz.ISysConfigService;
import com.missilike.core.result.CommonResult;
import com.missilike.core.utils.ResultUtils;
import com.missilike.domain.request.MilAdvertForm;
import com.missilike.domain.response.SysMenuInfo;
import com.missilike.repository.entity.SysConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author kin
 * @since 2019-01-08
 */
@RestController
@RequestMapping("/api/sys/config")
public class SysConfigController {

    private final ISysConfigService sysConfigService;

    @Autowired
    public SysConfigController(ISysConfigService sysConfigService) {
        this.sysConfigService = sysConfigService;
    }

    @RequestMapping(value = "list", method = RequestMethod.GET)
    public CommonResult list() {
        List<SysConfig> list = sysConfigService.list(null);
        return ResultUtils.ok(list);
    }

    @RequestMapping(value = "update", method = RequestMethod.POST)
    public CommonResult update(@RequestBody SysConfig sysConfig) {
        sysConfigService.updateById(sysConfig);
        return ResultUtils.ok();
    }

}

